package me.liangdi.spring.todo.web;

import me.liangdi.spring.todo.bean.TodoList;
import me.liangdi.spring.todo.repository.TodoListRepository;
import me.liangdi.spring.todo.repository.TodoRepository;
import me.liangdi.spring.util.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * Created by liangdi on 1/5/16.
 */
@RestController
@RequestMapping("/api/todo")
public class TodoApiController {
    public static final Logger LOGGER = LoggerFactory.getLogger(TodoApiController.class);

    @Autowired
    TodoListRepository todoListRepository;
    @Autowired
    TodoRepository todoRepository;

    @RequestMapping("/list/all")
    public Map<String,Object> allList() {
        List<TodoList> all = todoListRepository.findAll();

        return Result.success(all);
    }

}
